package string;
/*
    boolean equals(Object anObject) : 比较2个字符串的内容是否相同 -> 验证账号和密码
    String类中equals方法的源码
    Boolean equalsIgnoreCase(String anotherString) : 比较2个字符串内容是否相同忽略大小写 - > 验证验证码

 */

public class StringDemo1 {
    public static void main(String[] args) {
        String str1 = "hello";
        String str2 = "hello";


        String str3 = new String("hello");
        String str4 = new String("hello");


        char[] chs = {'H','e','l','l','o'};
        String str5 = new String(chs);


        System.out.println("str1.equals(str2) = " + str1.equals(str2));
        System.out.println("str1.equals(str3) = " + str1.equals(str3));
        System.out.println("str3.equals(str4) = " + str3.equals(str4));
        System.out.println("str1.equals(str5) = " + str1.equals(str5));//false
        System.out.println("str3.equals(str5) = " + str3.equals(str5));//false


        System.out.println("str1.equalsIgnoreCase(str5) = " + str1.equalsIgnoreCase(str5));//false
        System.out.println("str3.equalsIgnoreCase(str5) = " + str3.equalsIgnoreCase(str5));//false


    }


}
